package analyticsServer;

import java.util.ArrayList;

/**
 * Class for Events concerning Statistices
 * 
 * @author Group 95
 */
public class StatisticsEvent extends Event
{
    protected double value;
    
    public static String USER_SESSIONTIME_MIN="USER_SESSIONTIME_MIN";
    public static String USER_SESSIONTIME_MAX="USER_SESSIONTIME_MAX";
    public static String USER_SESSIONTIME_AVG="USER_SESSIONTIME_AVG";
    public static String BID_PRICE_MAX="BID_PRICE_MAX";
    public static String BID_COUNT_PER_MINUTE="BID_COUNT_PER_MINUTE";
    public static String AUCTION_TIME_AVG="AUCTION_TIME_AVG";
    public static String AUCTION_SUCCESS_RATIO="AUCTION_SUCCESS_RATIO";
    
    
    public StatisticsEvent(String server,String type,long timestamp,double value)
    {
        super(server,type,timestamp);
        this.value=value;
    }

    
    @Override
    public String toString()
    {
        String strRet=super.toString();
        if(type.equals(USER_SESSIONTIME_MIN))
        {
            strRet+="minimum session time is "+(int)value+" seconds";
        }
        else if(type.equals(USER_SESSIONTIME_MAX))
        {
            strRet+="maximum session time is "+(int)value+" seconds";
        }
        else if(type.equals(USER_SESSIONTIME_AVG))
        {
            strRet+="average session time is "+(int)value+" seconds";
        }
        else if(type.equals(BID_PRICE_MAX))
        {
            strRet+="maximum bid price seen so far is "+value;
        }
        else if(type.equals(BID_COUNT_PER_MINUTE))
        {
            strRet+="current bids per minute is "+value;
        }
        else if(type.equals(AUCTION_TIME_AVG))
        {
            strRet+="average auction time is "+(int)value+" seconds";
        }
        else if(type.equals(AUCTION_SUCCESS_RATIO))
        {
            strRet+="current auction success ratio is "+value;
        }        
        return strRet;
    }
    
    
    @Override
    public ArrayList<StatisticsEvent> calculate(EventCalculator calculator)
    {
        return null;
    }        
}
